<template>
   <van-tabbar route>
      <van-tabbar-item to="/" icon="home-o">主页</van-tabbar-item>
      <van-tabbar-item to="/cart" icon="cart-o">购物车</van-tabbar-item>
      <van-tabbar-item :to="userPath" icon="user-o">{{ userContent }}</van-tabbar-item>
   </van-tabbar>
</template>

<script setup lang="ts">
import {  computed } from 'vue';

//  userPath 如果没有登录， 那么显示 login; 如果登录了， 那么显示个人中心 user组件

const userPath = computed(()=>{
   return localStorage.getItem('userid')?'/user':'/login';
})

const userContent = computed(()=>{
   return localStorage.getItem('userid')?'我的':'登录'
})
 
</script>

<style scoped lang="scss"></style>